package com.kll.carolinehmibiz.base.net.rx

import io.reactivex.Observable
import io.reactivex.Observer
import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.schedulers.Schedulers


/**
 * ====================================================
 * Created by Ziliang Cai on 2021/12/7 00:10
 * <a href="mailto:752577456@qq.com">Contact me</a>
 * ====================================================
 */
open class RxBase {

    protected fun <T> toSubscribe(o: Observable<T>?, observer: Observer<T>) {
        o?.subscribeOn(Schedulers.io())?.unsubscribeOn(Schedulers.io())?.observeOn(AndroidSchedulers.mainThread())
            ?.subscribeWith(observer)
    }

//    protected fun <T> toSubscribe(o: Observable<T>, observer: Observable<T>) {
//        o?.subscribeOn(Schedulers.io())?.unsubscribeOn(Schedulers.io())?.observeOn(AndroidSchedulers.mainThread())?.subscribeWith(observer)
//    }
}